<?php

        $total = $VARS[pilots][total];
        $supply = $VARS[supply];

?>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><div align="center" class="text4"><?php echo $SLANG[$lang][squadcommonstat]; ?></div></td>
          </tr>
          <tr>
            <td height="50">&nbsp;</td>
            </tr>
          <tr>
            <td>
            <table width="100%"  border="1" cellspacing="0" cellpadding="0">
              <tr>
                <td width="250" align="left" valign="top"><img src="<!--ImageURL--><!--Flag-->" width="200" height="400"></td>
                <td align="left" valign="top">
                <table width="400"  border="1" align="left" cellpadding="0" cellspacing="0">
                  <tr valign="middle">
                    <td height="20" colspan="2" align="left">
                    <table width="400" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width=150 align="left" valign="middle"><div align="left"><?php echo $SLANG[$lang][nazvanie]; ?></div></td>
                        <td width=250 align="left" valign="middle" class="text9"><!--name--></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][regdate]; ?></td>
                        <td align="left" valign="middle" class="text9"><!--regdate--></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][sqcommander]; ?></td>
                        <td align="left" valign="middle" class="text8">
                        <a href="<!--SiteURL--><!--cohref-->" class="text9"><!--coname--></a></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][sqxcommander]; ?></td>
                        <td align="left" valign="middle" class="text8">
                        <a href="<!--SiteURL--><!--xohref-->" class="text9"><!--xoname--></a></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][planetype]; ?></td>
                        <td align="left" valign="middle" class="text9"><!--planetype--></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][planesleft]; ?></td>
                        <td align="left" valign="middle" class="text9"><!--planesleft--></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][baseplace]; ?></td>
                        <td align="left" valign="middle" class="text9"><!--basename--></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][squadpilots]; ?></td>
                        <td align="left" valign="middle" class="text9"><!--pilots--></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][naletchasov]; ?></td>
                        <td align="left" valign="middle" class="text9"><?php echo $total[time];?></td>
                      </tr>
                      <tr>
                        <td align="left" valign="middle"><?php echo $SLANG[$lang][sorties]; ?></td>
                        <td align="left" valign="middle" class="text9"><?php echo $total[s];?></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                    </table></td>

                  </tr>
                  <tr valign="middle">
                    <td height="20" colspan="2" align="left"><div align="left" class="text5"></div></td>
                    </tr>
                  <tr valign="top">
                    <td align="left"><table width="200" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="10" colspan="2" class="table7">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2"><?php echo $SLANG[$lang][unichtojeno]; ?>:</td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2">&nbsp;</td>
                        </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][samoletov]; ?></td>
                        <td width="50"><?php echo $total[aair]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][istribiteley]; ?></td>
                        <td width="50"><?php echo $total[fig]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][bombardirivshikov]; ?></td>
                        <td width="50"><?php echo $total[bom]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][transportnih]; ?></td>
                        <td width="50">0</td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][tehniki]; ?></td>
                        <td width="50"><?php echo $total[gk]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][orudiyaaa]; ?></td>
                        <td width="50"><?php echo $total[aaa]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][orudiy]; ?></td>
                        <td width="50"><?php echo $total[art]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][tankov]; ?></td>
                        <td width="50"><?php echo $total[tank]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][avtomobiley]; ?></td>
                        <td width="50"><?php echo $total[car]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][wagonov]; ?></td>
                        <td width="50"><?php echo $total[wag]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][korabley]; ?></td>
                        <td width="50"><?php echo $total[ship]?></td>
                      </tr>
                    </table>                      </td>
                    <td align="left"><table width="200" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="10" colspan="2" class="table7">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2"><?php echo $SLANG[$lang][poteri]; ?>:</td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2">&nbsp;</td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][samoletov]; ?></td>
                        <td width="50"><?php echo $total[planelose]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][pilotov]; ?></td>
                        <td width="50"><?php echo $total[pilotlose]?></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td width="50">&nbsp;</td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][iznih]; ?>: </td>
                        <td width="50">&nbsp;</td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][ubitimi]; ?></td>
                        <td width="50"><?php echo $total[DIED]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][plennimi]; ?></td>
                        <td width="50"><?php echo $total[CAPTURED]?></td>
                      </tr>
                      <tr>
                        <td>DISCO</td>
                        <td width="50"><?php echo $total[DISCO]?></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td width="50">&nbsp;</td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][bailed]; ?></td>
                        <td width="50"><?php echo $total[BAIL]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][wounded]; ?></td>
                        <td width="50"><?php echo $total[wound]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][avariynihposadok]; ?></td>
                        <td width="50"><?php echo $total[CRASHED]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][posadok]; ?></td>
                        <td width="50"><?php echo $total[TKON]?></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td width="50">&nbsp;</td>
                      </tr>
                    </table></td>

                  </tr>
                  <tr valign="middle">
                    <td height="10" colspan="2" align="left">&nbsp;</td>
                  </tr>
                  <tr valign="top">
                    <td height="20" align="left" class="text5"><table width="200" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="20" colspan="2" class="table7">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2"><?php echo $SLANG[$lang][snabjeniyadostavleno]; ?></td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2">&nbsp;</td>
                        </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][fuel]; ?></td>
                        <td width="50"><?php echo $supply[addfuel]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][ammo]; ?> </td>
                        <td width="50"><?php echo $supply[addammo]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][rkits]; ?></td>
                        <td width="50"><?php echo $supply[addrepair]?></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td width="50">&nbsp;</td>
                      </tr>
                    </table></td>
                    <td height="20" align="left" class="text5"><table width="200" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="20" colspan="2" class="table7">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2"><?php echo $SLANG[$lang][snabjeniyazatracheno]; ?></td>
                      </tr>
                      <tr>
                        <td height="20" colspan="2">&nbsp;</td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][fuel]; ?></td>
                        <td width="50"><?php echo $supply[fuel]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][ammo]; ?></td>
                        <td width="50"><?php echo $supply[ammo]?></td>
                      </tr>
                      <tr>
                        <td><?php echo $SLANG[$lang][rkits]; ?></td>
                        <td width="50"><?php echo $supply[repair]?></td>
                      </tr>
                      <tr>
                        <td height="10">&nbsp;</td>
                        <td width="50">&nbsp;</td>
                      </tr>
                    </table></td>

                  </tr>
                </table>
                  </td>
              </tr>
            </table></td>

          </tr>
          <tr>
            <td height="10">&nbsp;</td>
          </tr>
          <tr>
            <td height="10" align="center" valign="top">
            <table width="90%"  border="0" cellpadding="0" cellspacing="0" class="table5">
              <tr>
                <td width="100%" height="20" class="table4">&nbsp;</td>
                <td width="40" rowspan="2" align="left" valign="top"><img src="<!--ImageURL--><!--icon-->" width="40" height="40"></td>
              </tr>
              <tr>
                <td height="20" class="back5">&nbsp;</td>
              </tr>
              <tr align="center" valign="top">
                <td height="20" colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="30"><div align="center"><!--callsignmark--><a href="<!--SiteURL-->squads/<!--sqid-->/callsign/index.html" class="text8">Name</a><!--callsignmark--></div></td>
                    <td><div align="center"><!--DIEDmark--><a href="<!--SiteURL-->squads/<!--sqid-->/DIED/index.html" class="text8">Deaths</a><!--DIEDmark--></div></td>
                    <td><div align="center"><!--DISCOmark--><a href="<!--SiteURL-->squads/<!--sqid-->/DISCO/index.html" class="text8">Disco</a><!--DISCOmark--></div></td>
                    <td><div align="center"><!--CAPTUREDmark--><a href="<!--SiteURL-->squads/<!--sqid-->/CAPTURED/index.html" class="text8">Captured</a><!--CAPTUREDmark--></div></td>
                    <td><div align="center"><!--BAILmark--><a href="<!--SiteURL-->squads/<!--sqid-->/BAIL/index.html" class="text8">Bailed</a><!--BAILmark--></div></td>
                    <td><div align="center"><!--planelosemark--><a href="<!--SiteURL-->squads/<!--sqid-->/planelose/index.html" class="text8">Plane lose </a><!--planelosemark--></div></td>
                    <td><div align="center"><!--sortiesmark--><a href="<!--SiteURL-->squads/<!--sqid-->/sorties/index.html" class="text8">Sorties</a><!--sortiesmark--></div></td>
                    <td><div align="center"><!--TKONmark--><a href="<!--SiteURL-->squads/<!--sqid-->/TKON/index.html" class="text8">Landed</a><!--TKONmark--></div></td>
                    <td><div align="center"><!--ftimemark--><a href="<!--SiteURL-->squads/<!--sqid-->/ftime/index.html" class="text8">Time</a><!--ftimemark--></div></td>
                    <td><div align="center"><!--aairmark--><a href="<!--SiteURL-->squads/<!--sqid-->/aair/index.html" class="text8">Air Kills</a><!--aairmark--></div></td>
                    <td><div align="center"><!--airmark--><a href="<!--SiteURL-->squads/<!--sqid-->/air/index.html" class="text8">Fighters</a><!--airmark--></div></td>
                    <td><div align="center"><!--bommark--><a href="<!--SiteURL-->squads/<!--sqid-->/bom/index.html" class="text8">Bombers</a><!--bommark--></div></td>
                    <td><div align="center"><!--kdmark--><a href="<!--SiteURL-->squads/<!--sqid-->/kd/index.html" class="text8">k/d</a><!--kdmark--></div></td>
                    <td><div align="center"><!--ksmark--><a href="<!--SiteURL-->squads/<!--sqid-->/ks/index.html" class="text8">k/s</a><!--ksmark--></div></td>
                    <td><div align="center"><!--groundmark--><a href="<!--SiteURL-->squads/<!--sqid-->/ground/index.html" class="text8">Destroy</a><!--groundmark--></div></td>
                    <td align="center" valign="middle"><div align="center"><!--gkdmark--><a href="<!--SiteURL-->squads/<!--sqid-->/gkd/index.html" class="text8">gk/d</a><!--gkdmark--></div></td>
                    <td><div align="center"><!--gksmark--><a href="<!--SiteURL-->squads/<!--sqid-->/gks/index.html" class="text8">gk/s</a><!--gksmark--></div></td>
                  </tr>
                  <tr>
                    <td height="10" colspan="15">&nbsp;</td>
                    </tr>

	<?php
    	$pilots = $VARS[pilots][pilots];

        $i=0;
        if(is_array($pilots))
        foreach ($pilots as $pilot) {


            if ($i % 2 == 0)
            	$cl = "tr1";
            else
            	$cl = "tr2";
            $i++;

	?>
                  <tr class="<?php echo $cl;?>">
                    <td height="20">
                    &nbsp;&nbsp;&nbsp;
                    <span align="left" class="text8"><a href="<!--SiteURL-->pilots/<?php echo $pilot[pilotid];?>/index.html" class="text8"><?php echo $pilot[callsign]?></a></span></td>
                    <td height="20"><div align="center"><?php echo $pilot[DIED]?></span></td>
                    <td><div align="center"><?php echo $pilot[DISCO]?></div></td>
                    <td><div align="center"><?php echo $pilot[CAPTURED]?></div></td>
                    <td><div align="center"><?php echo $pilot[BAIL]?></div></td>
                    <td><div align="center"><?phpecho $pilot[DIED]+$pilot[CAPTURED]+$pilot[BAIL];?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[sorties]?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[TKON]?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[ftime]?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[aair];?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[fig];?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[bom];?></div></td>
<?php            if ($pilot[sorties] == 0) $pilot[sorties] = 1;
            if ($pilot[DIED]+$pilot[CAPTURED]+$pilot[DISCO] == 0) $pilot[DIED] = 1;
?>
                    <td height="20"><div align="center"><?php echo round($pilot[aair]/($pilot[DIED]+$pilot[CAPTURED]+$pilot[DISCO]),2);?></div></td>
                    <td height="20"><div align="center"><?php echo round($pilot[aair]/$pilot[sorties],2);?></div></td>
                    <td height="20"><div align="center"><?php echo $pilot[ground]?></div></td>
                    <td height="20"><div align="center"><?php echo round($pilot[ground]/($pilot[DIED]+$pilot[CAPTURED]+$pilot[DISCO]),2);?></div></td>
                    <td height="20"><div align="center"><?php echo round($pilot[ground]/$pilot[sorties],2);?></div></td>
                  </tr>
	<?php
    	}
    ?>

                  <tr>
                    <td height="10" colspan="15">&nbsp;</td>
                    </tr>
                  <tr bgcolor="#333333">
                    <td height="20"><div align="center">TOTAL</div></td>
                    <td height="20"><div align="center"><?php echo $total[deths];?></div></td>
                    <td><div align="center"><?php echo $total[DISCO];?></div></td>
                    <td><div align="center"><?php echo $total[captured];?></div></td>
                    <td><div align="center"><?php echo $total[bailed];?></div></td>
                    <td><div align="center"><?php echo $total[planelose];?></div></td>
                    <td height="20"><div align="center"><?php echo $total[s];?></div></td>
                    <td height="20"><div align="center"><?php echo $total[TKON];?></div></td>
                    <td height="20"><div align="center"><?php echo $total[time];?></div></td>
                    <td height="20"><div align="center"><?php echo $total[aair];?></div></td>
                    <td height="20"><div align="center"><?php echo $total[fig];?></div></td>
                    <td height="20"><div align="center"><?php echo $total[bom];?></div></td>
                    <td height="20"><div align="center"><?php
                    	if (!$total[d]) $total[d] =1;
                        echo round($total[aair]/$total[d],2);?></div></td>
                    <td height="20"><div align="center"><?php
	                    if (!$total[s]) $total[s] =1;
                        echo round($total[aair]/$total[s],2);?></div></td>
                    <td height="20"><div align="center"><?php echo $total[gk];?></div></td>
                    <td height="20"><div align="center"><?php echo round($total[gk]/$total[d],2);?></div></td>
                    <td height="20"><div align="center"><?php echo round($total[gk]/$total[s],2);?></div></td>
                  </tr>
                  <tr>
                    <td height="10" colspan="15">&nbsp;</td>
                    </tr>
                </table>
                </td>

                </tr>
            </table>
            </td>
          </tr>
        </table>